package pub.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Role entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "role", catalog = "sddf")
public class Role implements java.io.Serializable {

	// Fields

	private Integer id;
	private String name;
	private String describe;
	private Set<Rolefunction> rolefunctions = new HashSet<Rolefunction>(0);
	private Set<Uerinfo> uerinfos = new HashSet<Uerinfo>(0);

	// Constructors

	/** default constructor */
	public Role() {
	}

	/** minimal constructor */
	public Role(String name) {
		this.name = name;
	}

	/** full constructor */
	public Role(String name, String describe, Set<Rolefunction> rolefunctions, Set<Uerinfo> uerinfos) {
		this.name = name;
		this.describe = describe;
		this.rolefunctions = rolefunctions;
		this.uerinfos = uerinfos;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "describe", length = 50)
	public String getDescribe() {
		return this.describe;
	}

	public void setDescribe(String describe) {
		this.describe = describe;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "role")
	public Set<Rolefunction> getRolefunctions() {
		return this.rolefunctions;
	}

	public void setRolefunctions(Set<Rolefunction> rolefunctions) {
		this.rolefunctions = rolefunctions;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "role")
	public Set<Uerinfo> getUerinfos() {
		return this.uerinfos;
	}

	public void setUerinfos(Set<Uerinfo> uerinfos) {
		this.uerinfos = uerinfos;
	}

}